home *** CD-ROM | disk | FTP | other *** search
/ Delphi 5 for Professionals / DELPHI5.iso / AddOns / Components / CHIPDRIVE ToolBox API-Kit / TOOLBOX / DISK3 / _SETUP.3 / Group15 / C-SAMPLE.TXT next >
Encoding:
Text File  |  1998-09-02  |  2.1 KB  |  54 lines

  1. -------------------------------------------------------------------
  2. - SCARD C, C++ Sample Code                                        -
  3. - ⌐ 98 TOWITOKO electronics GmbH, Munich                          -
  4. -------------------------------------------------------------------
  5.  
  6. The following code will show the recommended import syntax. 
  7. SCARD should be loaded dynamically, please do not use any 
  8. LIB-Import files:
  9.  
  10. //-----------------------------------------------------------------
  11. HINSTANCE hDll;
  12. long (__stdcall * SCardComand)(long *handle, char *Cmd, long *CmdLen, char *DataIn, long *DataInLen, char *DataOut, long *DataOutLen);
  13. long CmdLen,DataInLen,DataOutLen;
  14. char *Cmd,*DataIn,*DataOut;
  15. void test()
  16. {
  17.     hDll=LoadLibrary("scard32.dll");
  18.     if(hDll!=NULL)
  19.     {
  20.         SCardComand=(long (__stdcall * )(long *handle, char *Cmd, long *CmdLen, char *DataIn, long *DataInLen, char *DataOut, long *DataOutLen))GetProcAddress(hDll,"SCardComand");
  21.  
  22.         Cmd=(char*)malloc(255);
  23.         DataIn=(char*)malloc(255);
  24.         DataOut=(char*)malloc(255);
  25.         long ret;
  26.         strcpy(Cmd,"System,Info");
  27.         strcpy(DataIn,"");
  28.         strcpy(DataOut,"");
  29.         CmdLen=11;
  30.         DataInLen=0;
  31.         DataOutLen=254;
  32.         long handle=0;
  33.         ret=SCardComand(&handle,Cmd,&CmdLen,DataIn,&DataInLen,DataOut,&DataOutLen);
  34.         CString text;
  35.         text.Format("System,Info liefert %d und %s",ret,DataOut);
  36.         MessageBox(NULL,text,text,MB_APPLMODAL);
  37.     }
  38. }
  39. //-----------------------------------------------------------------
  40.  
  41.  
  42.  
  43.  
  44. -------------------------------------------------------------------
  45. - ⌐ 1998 TOWITOKO electronics GmbH                                -
  46. -   Rotwandweg 3                                                  -
  47. -   D-82024 Taufkirchen/Munich                                    -
  48. -   GERMANY                                                       -
  49. -   http://www.towitoko.com                                       -
  50. -   http://www.towitoko.de                                        -
  51. -   email: support@towitoko.de                                    -
  52. -------------------------------------------------------------------
  53.  
  54.